package com.bdqn.wf4.cinconsumer.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.bdqn.wf4.cinbase.pojo.Film;
import com.bdqn.wf4.cinbase.service.FilmService;
import com.bdqn.wf4.cinbase.util.PageData;
import org.springframework.web.bind.annotation.*;

@RestController
public class TestController {
    @Reference
    FilmService filmService;

    @RequestMapping("showfilm")
    public PageData<Film> Index(@RequestParam(value = "uname",required = false) String uname,
                                @RequestParam(value = "actstar",required = false) String actstar,
                                @RequestParam(value = "pageIndex",defaultValue = "1") int pageIndex) {
        int pageSize=3;
        PageData<Film> pageData = filmService.getPageData(uname, actstar,
                pageIndex, pageSize);
        return pageData;
    }

    @RequestMapping("checkaddes")
    public int Check(Film film) {
        return filmService.update(film);
    }

    @RequestMapping("toaddes")
    public Film toPing(int id) {
        return filmService.getById(id);
    }

    @RequestMapping("addes")
    public int Ping(Film film) {
        return filmService.uadd(film);
    }
}